import { ApiProperty } from '@nestjs/swagger';
import { PrimaryGeneratedColumn, Column, Entity } from 'typeorm';

@Entity()
export class Work {
  @ApiProperty({ description: 'id' })
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ comment: '图片' })
  imgUrl: string;

  @Column({ comment: '作品名' })
  name: string;

  @Column({
    default: 0,
    comment: '排序',
  })
  priority: number;

  @Column({ comment: '描述' })
  desc: string;

  @Column({
    nullable: true,
    comment: '路径',
  })
  linkUrl: string;

  @Column({
    nullable: true,
    comment: '来源',
  })
  sourceUrl: string;

  @ApiProperty({ description: '创建时间' })
  @Column({
    type: 'timestamp',
    comment: '创建时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createTime: Date;

  @ApiProperty({ description: '修改时间' })
  @Column({
    type: 'timestamp',
    comment: '修改时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  updateTime: Date;
}
